package com.wzdigit.wms.basic.mapper.core.basic;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.wzdigit.framework.orm.mybatis.MyBatisRepository;
import com.wzdigit.wms.basic.domain.basic.Location;
import com.wzdigit.wms.basic.client.request.basic.SearchLocationRequest;
import com.wzdigit.wms.basic.client.response.basic.LocationApiResponse;
import com.wzdigit.wms.basic.client.response.basic.LocationResponse;
import com.wzdigit.wms.basic.client.response.basic.RecommendedLocationResponse;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * <p>
 * 库位 Mapper 接口
 * </p>
 *
 * @author 
 * @since 2020-12-28
 */
@MyBatisRepository
public interface LocationMapper extends BaseMapper<Location> {
	
	@SuppressWarnings("rawtypes")
	List<LocationResponse> selectAll(@Param("dto") SearchLocationRequest dto);
	
	//获取推荐上架库位
	List<RecommendedLocationResponse> getRecommendedUpLocation(@Param("goodSn") String goodSn);
	
	//根据库位获取仓库+库位信息
	RecommendedLocationResponse selectWareHouseByLocCodeAndStatus(@Param("locCode") String locCode, 
			@Param("status") Integer status);
	
	LocationResponse selectOneByLocId(@Param("locId") Integer locId);
	
	List<LocationApiResponse> selectAllByStatus(@Param("status") Integer status);
	
	List<LocationApiResponse> selectAllByZoneIdAndStatus(@Param("zoneId") Integer zoneId, 
			@Param("status") Integer status);
	
	List<LocationApiResponse> selectAllByWhsIdAndStatus(@Param("whsId") Integer whsId, 
			@Param("status") Integer status);

	Location selectOneByLocCode(@Param("locCode") String locCode);

	Location selectOneByLocDesc(@Param("locDesc") String locDesc);
	
	List<String> selectLocCodeListByLocIdList(@Param("locIdList") List<Integer> locIdList);
	
	List<String> selectLocCodeListByWhsId(@Param("rowsize") Integer rowsize, @Param("whsId") Integer whsId);
	
	int updateStatus(Location record);
	
    int deleteByPrimaryKey(Integer locId);

    int insert(Location record);

    Location selectByPrimaryKey(Integer locId);

    int updateByPrimaryKeySelective(Location record);

    int updateByPrimaryKey(Location record);

	Integer selectWhsIdBylocId(Integer targetLocId);
}